#!/bin/sh -x

DATE=`date +%Y%m%d`

test -e /org/lists.debian.org/spam-log/spam-report.log     && mv /org/lists.debian.org/spam-log/spam-report.log     /org/lists.debian.org/spam-log/spam-report.log.0
test -e /org/lists.debian.org/spam-log/spam-review.log     && mv /org/lists.debian.org/spam-log/spam-review.log     /org/lists.debian.org/spam-log/spam-review.log.0
test -e /org/lists.debian.org/spam-log/queue-nominator.log && mv /org/lists.debian.org/spam-log/queue-nominator.log /org/lists.debian.org/spam-log/queue-nominator.log.0
test -e /var/list/listspam/nominator.log                   && mv /var/list/listspam/nominator.log                   /org/lists.debian.org/spam-log/mail-nominator.log.0
test -e /org/lists.debian.org/spam-log/msgid-nominator.log && mv /org/lists.debian.org/spam-log/msgid-nominator.log /org/lists.debian.org/spam-log/msgid-nominator.log.0

test -e /org/lists.debian.org/spam-log/queue-nominator.log.0 && /org/lists.debian.org/archive-spam-removals/bin/msgidreport2spamreport.pl /org/lists.debian.org/spam-log/queue-nominator.log.0
test -e /org/lists.debian.org/spam-log/mail-nominator.log.0  && /org/lists.debian.org/archive-spam-removals/bin/msgidreport2spamreport.pl /org/lists.debian.org/spam-log/mail-nominator.log.0
test -e /org/lists.debian.org/spam-log/msgid-nominator.log.0 && /org/lists.debian.org/archive-spam-removals/bin/msgidreport2spamreport.pl /org/lists.debian.org/spam-log/msgid-nominator.log.0
/org/lists.debian.org/archive-spam-removals/bin/review1-nominate.pl

test -e /org/lists.debian.org/spam-log/spam-report.log.0     && mv /org/lists.debian.org/spam-log/spam-report.log.0     /org/lists.debian.org/spam-log/spam-report.log.$DATE
test -e /org/lists.debian.org/spam-log/spam-review.log.0     && mv /org/lists.debian.org/spam-log/spam-review.log.0     /org/lists.debian.org/spam-log/spam-review.log.$DATE
test -e /org/lists.debian.org/spam-log/queue-nominator.log.0 && rm /org/lists.debian.org/spam-log/queue-nominator.log.0
test -e /org/lists.debian.org/spam-log/mail-nominator.log.0  && mv /org/lists.debian.org/spam-log/mail-nominator.log.0  /org/lists.debian.org/spam-log/mail-nominator.log.$DATE
test -e /org/lists.debian.org/spam-log/msgid-nominator.log.0 && mv /org/lists.debian.org/spam-log/msgid-nominator.log.0 /org/lists.debian.org/spam-log/msgid-nominator.log.$DATE

gzip -9 /org/lists.debian.org/spam-log/*.log.$DATE

#find /org/lists.debian.org/www -mtime -2 -type f -print0 |xargs -0 clamscan -i
#/org/lists.debian.org/archive-spam-removals/bin/merge-spam-files

/org/lists.debian.org/archive-spam-removals/bin/spamremove-statistic.pl > /org/lists.debian.org/archive-spam-removals/review/stats.html
